package com.china08.yxyapi.repository.mg.lecture;

import java.util.List;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.repository.MongoRepository;

import com.china08.yxyapi.entity.mg.lecture.YxyLecturePrePack;

/**
 * @author Richard.Wang
 * @descript 备授课资源包
 */
public interface YxyLecturePrePackRepository extends MongoRepository<YxyLecturePrePack, String> {

    YxyLecturePrePack findById(String id);

    Page<YxyLecturePrePack> findById(List<String> list, Pageable pageable);

    YxyLecturePrePack findByIdAndUserIdAndSchoolIdAndIsDeleteNot(String id, String userId, String schoolId,
            Integer delete);

    Page<YxyLecturePrePack> findByUserIdAndSchoolIdAndBookcontentsIdAndIsDeleteNot(String userId, String schoolId,
            String bookContentId, Integer delete, Pageable pageable);

    Page<YxyLecturePrePack> findByUserIdAndSchoolIdAndBookcontentsIdAndPackNameContainingAndIsDeleteNot(String userId,
            String schoolId, String bookContentId, String keyword, Integer delete, Pageable pageable);

    YxyLecturePrePack findTop1ByIsYxAndBookcontentsIdAndStatusNotAndShareOrderByUsedCountDesc(Integer isYx,
            String bookContentsId, Integer status, Integer share);

    List<YxyLecturePrePack> findByUserIdAndSchoolIdAndPackNameAndIsDeleteNot(String userId, String schoolId,
            String packeName, Integer isDelete);

    YxyLecturePrePack findByUserIdAndSchoolIdAndReferencId(String userId, String schoolId, String referencId);

    Page<YxyLecturePrePack> findByBookcontentsIdInAndStatusAndShare(String[] arr, Integer status, Integer share,
            Pageable pageable);

    Page<YxyLecturePrePack> findByBookcontentsIdInAndShareAndStatusAndPackNameContaining(String[] bookContent,
            Integer share, Integer status, String keyword, Pageable pageable);

    Page<YxyLecturePrePack> findByBookcontentsIdInAndShareAndStatusAndUserNickContaining(String[] bookContent,
            Integer share, Integer status, String keyword, Pageable pageable);

    Page<YxyLecturePrePack> findByBookcontentsIdInAndShareAndStatusAndAreaIdProvinceAndAreaIdCityAndPackNameContaining(
            String[] bookContent, Integer share, Integer status, String areaIdProvince, String areaIdCity,
            String keyword, Pageable pageable);

    Page<YxyLecturePrePack> findByBookcontentsIdInAndShareAndStatusAndAreaIdProvinceAndAreaIdCityAndUserNickContaining(
            String[] bookContent, Integer share, Integer status, String areaIdProvince, String areaIdCity,
            String keyword, Pageable pageable);

    Page<YxyLecturePrePack> findByBookcontentsIdInAndStatusAndShareAndAreaIdProvinceAndAreaIdCity(String[] bookContent,
            Integer status, Integer share, String areaIdProvince, String areaIdCity, Pageable pageable);

    Page<YxyLecturePrePack> findBySchoolIdAndBookcontentsIdInAndShareAndStatusAndPackNameContaining(String schoolId,
            String[] bookContent, Integer share, Integer status, String keyword, Pageable pageable);

    Page<YxyLecturePrePack> findBySchoolIdAndBookcontentsIdInAndShareAndStatusAndUserNickContaining(String schoolId,
            String[] bookContent, Integer share, Integer status, String keyword, Pageable pageable);

    Page<YxyLecturePrePack> findBySchoolIdAndBookcontentsIdInAndShareAndStatus(String schoolId, String[] bookContent,
            Integer share, Integer status, Pageable pageable);

    List<YxyLecturePrePack> findByPackSizeNullOrPackSizeNot(int i);

    List<YxyLecturePrePack> findByPackSizeNullOrPackSize(int i);

    List<YxyLecturePrePack> findByAuditStatsAndSchoolIdAndBookcontentsIdInAndShareInAndStatus(int i, String schoolId,
            String[] bookContent, List<Integer> sList, Integer status);

    List<YxyLecturePrePack> findByBookcontentsIdInAndStatusAndShareAndIsViewAndAuditStatsOrBookcontentsIdInAndStatusAndSchoolIdAndIsViewAndAuditStats(
            String[] bookContent, Integer status, Integer share, int i, int j, String[] bookContent2, int k,
            String yunxiaoSchoolId, int l, int m);

    List<YxyLecturePrePack> findByBookcontentsIdInAndShareAndStatusAndAuditStatsAndAreaIdDistrict(String[] bookContent,
            Integer share, Integer status, int i, String areaId);

    List<YxyLecturePrePack> findByBookcontentsIdInAndShareAndStatusAndAuditStatsAndAreaIdCity(String[] bookContent,
            Integer share, Integer status, int i, String areaId);

    List<YxyLecturePrePack> findByBookcontentsIdInAndShareAndStatusAndAuditStatsAndAreaIdProvince(String[] bookContent,
            Integer share, Integer status, int i, String areaId);

    Page<YxyLecturePrePack> findByBookcontentsIdInAndShareAndStatusAndAuditStatsAndAreaIdDistrictAndPackNameContaining(
            String[] bookContent, Integer share, Integer status, int i, String areaId, String keyword,
            Pageable pageable);

    Page<YxyLecturePrePack> findByBookcontentsIdInAndShareAndStatusAndAuditStatsAndAreaIdCityAndPackNameContaining(
            String[] bookContent, Integer share, Integer status, int i, String areaId, String keyword,
            Pageable pageable);

    Page<YxyLecturePrePack> findByBookcontentsIdInAndShareAndStatusAndAuditStatsAndAreaIdProvinceAndPackNameContaining(
            String[] bookContent, Integer share, Integer status, int i, String areaId, String keyword,
            Pageable pageable);

    Page<YxyLecturePrePack> findByBookcontentsIdInAndShareAndStatusAndAuditStatsAndAreaIdDistrictAndUserNickContaining(
            String[] bookContent, Integer share, Integer status, int i, String areaId, String keyword,
            Pageable pageable);

    Page<YxyLecturePrePack> findByBookcontentsIdInAndShareAndStatusAndAuditStatsAndAreaIdCityAndUserNickContaining(
            String[] bookContent, Integer share, Integer status, int i, String areaId, String keyword,
            Pageable pageable);

    Page<YxyLecturePrePack> findByBookcontentsIdInAndShareAndStatusAndAuditStatsAndAreaIdProvinceAndUserNickContaining(
            String[] bookContent, Integer share, Integer status, int i, String areaId, String keyword,
            Pageable pageable);

    Page<YxyLecturePrePack> findByBookcontentsIdInAndShareAndStatusAndAuditStatsAndAreaIdDistrict(String[] bookContent,
            Integer share, Integer status, int i, String areaId, Pageable pageable);

    Page<YxyLecturePrePack> findByBookcontentsIdInAndShareAndStatusAndAuditStatsAndAreaIdCity(String[] bookContent,
            Integer share, Integer status, int i, String areaId, Pageable pageable);

    Page<YxyLecturePrePack> findByBookcontentsIdInAndShareAndStatusAndAuditStatsAndAreaIdProvince(String[] bookContent,
            Integer share, Integer status, int i, String areaId, Pageable pageable);

    Page<YxyLecturePrePack> findByBookcontentsIdInAndStatusAndShareAndIsViewAndAuditStatsAndPackNameContainingOrBookcontentsIdInAndStatusAndSchoolIdAndIsViewAndAuditStatsAndPackNameContaining(
            String[] bookContent, Integer status, Integer share, int i, int j, String keyword, String[] bookContent2,
            int k, String yunxiaoSchoolId, int l, int m, String keyword2, Pageable pageable);

    Page<YxyLecturePrePack> findByBookcontentsIdInAndStatusAndShareAndIsViewAndAuditStatsAndUserNickContainingOrBookcontentsIdInAndStatusAndSchoolIdAndIsViewAndAuditStatsAndUserNickContaining(
            String[] bookContent, Integer status, Integer share, int i, int j, String keyword, String[] bookContent2,
            int k, String yunxiaoSchoolId, int l, int m, String keyword2, Pageable pageable);

    Page<YxyLecturePrePack> findByBookcontentsIdInAndStatusAndShareAndIsViewAndAuditStatsOrBookcontentsIdInAndStatusAndSchoolIdAndIsViewAndAuditStats(
            String[] bookContent, Integer status, Integer share, int i, int j, String[] bookContent2, int k,
            String yunxiaoSchoolId, int l, int m, Pageable pageable);

    List<YxyLecturePrePack> findTop1000ByIsSyncAndIsDeleteNot(boolean b, int i);

    Page<YxyLecturePrePack> findByIsDeleteNot(int i, Pageable pageable);

    Page<YxyLecturePrePack> findByBookcontentsIdInAndShareNotAndStatusAndAuditStatsAndPackNameContaining(
            String[] bookContent, int i, int j, int k, String keyword, Pageable pageable);

    Page<YxyLecturePrePack> findByBookcontentsIdInAndShareNotAndStatusAndAuditStatsAndUserNickContaining(
            String[] bookContent, int i, int j, int k, String keyword, Pageable pageable);

    Page<YxyLecturePrePack> findByBookcontentsIdInAndShareNotAndStatusAndAuditStats(String[] bookContent, int i, int j,
            int k, Pageable pageable);

    Long countByAreaIdProvince(String districtCode);

    Long countByAreaIdCity(String districtCode);

    Long countByAreaIdDistrict(String districtCode);

    Long countByAreaIdDistrictAndPhaseIdAndSubjectId(String districtCode, String id, String string);

    Long countByAreaIdCityAndPhaseIdAndSubjectId(String districtCode, String id, String string);

    Long countByAreaIdProvinceAndPhaseIdAndSubjectId(String districtCode, String id, String string);

    List<YxyLecturePrePack> findByUserIdAndPhaseIdAndSubjectIdAndVersionIdAndShareAndIsDeleteNot(String userId,
            String phaseId, String subjectId, String versionId, int i, int j);

    List<YxyLecturePrePack> findByUserIdAndPhaseIdAndSubjectIdAndVersionIdAndSemesterIdInAndShareAndIsDeleteNot(
            String userId, String phaseId, String subjectId, String versionId, List<String> semester, int i, int j);

}
